"use strict"
/**
 *
 * @param {import("egg").Application} app
 */
module.exports = app => {
	const Sequelize = app.Sequelize
	const sequelize = app.model

	const AdminUser = sequelize.define("adminUser", {
		account: Sequelize.STRING(32),//mail //或者其他
		password: Sequelize.STRING(20),
		create_at: {
			type: Sequelize.DATE,
			defaultValue: sequelize.literal('CURRENT_TIMESTAMP'),
			get() {
				return Date.parse(this.getDataValue("create_at"))
			},
			// field: "create_at"
		},
		last_login: {
			type: Sequelize.DATE,
			defaultValue: sequelize.literal("CURRENT_TIMESTAMP"),
			get() {
				return Date.parse(this.getDataValue("lastLogin"))
			}
		},
		stat: {
			type: Sequelize.TINYINT
		},
	}, {
			comment: "管理员相关的表",
			timestamps: false,
			charset: "utf8",
			tableName: "admin_user"
		})
	return AdminUser
}
